import request from '@/utils/request'

/**
 * 查询登录日志列表
 */
export function getLogininforList(query?: any) {
  return request.get('/monitor/logininfor/list', query)
}

/**
 * 删除登录日志
 */
export function delLogininfor(infoIds: number | number[]) {
  const ids = Array.isArray(infoIds) ? infoIds.join(',') : infoIds
  return request.delete(`/monitor/logininfor/${ids}`, {}, {
    showLoading: true,
    showSuccess: true,
    successMsg: '删除成功',
  })
}

/**
 * 解锁用户登录状态
 */
export function unlockLogininfor(userName: string) {
  return request.get(`/monitor/logininfor/unlock/${userName}`, {}, {
    showLoading: true,
    showSuccess: true,
    successMsg: '用户解锁成功',
  })
}

/**
 * 清空登录日志
 */
export function cleanLogininfor() {
  return request.delete('/monitor/logininfor/clean', {}, {
    showLoading: true,
    showSuccess: true,
    successMsg: '清空成功',
  })
}

/**
 * 导出登录日志
 */
export function exportLogininfor(query?: any) {
  return request.post('/monitor/logininfor/export', query, {
    responseType: 'blob',
    showLoading: true,
  })
}

